<h1><a href="contents/admin/categories">โครงสร้าง</a> <?php echo (isset($parent))? '» '.admin_breadcrumb(get_category_breadcrumb($parent->id,TRUE)):'' ?></h1>
<?php echo $categories->pagination()?>
<?php if(@$parent->parent_id==0): ?>
<form method="post">
<?php endif;?>
<table class="list">
	<tr>
		<?php if(@$parent->parent_id==0): ?>
		<th>ลำดับ</th>
		<?php endif;?>
		<th>ชื่อ</th>
		<?php echo (isset($parent)) ? '<th>ตำแหน่ง</th>' : ''; ?>
		<th>รูปแบบ</th>
		<th width="90"><a class="btn" href="contents/admin/categories/form/<?php echo (isset($parent))?$parent->id:0 ?>" class="tiny">เพิ่มรายการ</a></th>
	</tr>
	<?php foreach($categories as $category): ?>
	<tr <?php echo cycle()?>>
		<?php if(@$parent->parent_id==0): ?>
		<td><input type="text" name="sequence[<?php echo $category->id ?>]" value="<?php echo $category->sequence ?>" style="width:30px;" /></td>
		<?php endif;?>
		<td><?php echo lang_decode($category->name)?></td>
		<?php if(isset($parent)): ?><td><?php echo ($category->parent->layout->description)?$category->parent->layout->description:$category->layout->parent->description; ?></td><?php endif; ?>
		<td><?php echo Category::child($category);?></td>
		<td>
			<a class="btn" href="contents/admin/categories/form/<?php echo (isset($parent))?$parent->id:0 ?>/<?php echo $category->id ?>" >แก้ไข</a>
			<a class="btn" href="contents/admin/categories/delete/<?php echo $category->id?>" onclick="return confirm('<?php echo 'หมวดหมู่ย่อยและบทความทั้งหมดในหมวดนี้จะถูกลบโดยอัตโนมัติ\nยืนยันการลบ'?>')">ลบ</a>
		</td>
	</tr>
	<?php endforeach; ?>
	<?php if(@$parent->parent_id==0): ?>
	<tr>
		<td><input type="submit" value="บันทึก" /></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
	<?php endif;?>
</table>
</form>
<?php echo $categories->pagination()?>
	